package com.example.rental.controller;

import com.example.rental.entity.Collect;
import com.example.rental.entity.dto.CollectDto;
import com.example.rental.service.CollectService;
import com.example.rental.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@CrossOrigin
@RestController
@RequestMapping("/collect")
public class collectController {
    @Autowired
    private CollectService collectService;
    @PostMapping("/search")
    public Result getCollect(@RequestBody CollectDto collectDto){
        Result list = collectService.getCollect(collectDto);
        return list;
    }
    @PostMapping("/add")
    public Result add(@RequestBody Collect collect){
        collectService.addCollect(collect);
        return Result.ok(collect);
    }
    @PostMapping("/del")
    public Result deleteCollect(@RequestBody Collect collect){
        collectService.deleteCollect(collect);
        return Result.ok(collect);
    }
}
